import common from './modules/common'
import sceneManage from './modules/sceneManage'
import blackWhiteManage from './modules/blackWhiteManage'

import request from './ajax'


export class Common {
    static async login(params: any) {
        const loginApi = common.login;
        return makeReq(loginApi, params);
    }
    static async logout(params: any) {   // 接口二
        const logoutApi = common.login;
        return makeReq(logoutApi, params);
    }
}

/**
 * 请求公共类
 * @param requestInfo 
 * @param params 
 * @returns 
 */
function makeReq(requestInfo:any, params:any) {
    return request(requestInfo.path,params, requestInfo.type)
}


export class SceneManage {     // 模块二
    /**
     * @description 获取地列表
     * @return {HttpResponse} result
     */
    static async getSceneInfo(params: any) {
        const getSceneInfo = sceneManage.getSceneInfo;
        return makeReq(getSceneInfo, params);
    }
    
    
    /**
     * @description 获取地列表
     * @return {HttpResponse} result
     */
    static async getSceneDimInfo(params: any) {
        const getSceneDimInfo = sceneManage.getSceneDimInfo;
        return makeReq(getSceneDimInfo, params);
    }

    /**
     * @description 新增场景
     * @return {HttpResponse} result
     */
    static async addSceneInfo(params: any) {
        const addScene = sceneManage.addScene;
        return makeReq(addScene, params);
    }
    
    /**
     * @description 删除
     * @return {HttpResponse} result
     */
    static async delScene(params: any) {
        const delScene = sceneManage.delScene;
        return makeReq(delScene, params);
    }
}


export class BlackWhiteManage {     // 模块二
    /**
     * @description 获取地列表
     * @return {HttpResponse} result
     */
    static async getBlackWhiteInfo(params: any) {
        const getBlackWhiteInfo = blackWhiteManage.getBlackWhiteInfo;
        return makeReq(getBlackWhiteInfo, params);
    }

    /**
     * @description 新增场景
     * @return {HttpResponse} result
     */
    static async addBlackWhiteInfo(params: any) {
        const addBlackWhiteInfo = blackWhiteManage.addBlackWhiteInfo;
        return makeReq(addBlackWhiteInfo, params);
    }
    
    /**
     * @description 删除
     * @return {HttpResponse} result
     */
    static async delBlackWhiteInfo(params: any) {
        const delBlackWhiteInfo = blackWhiteManage.delBlackWhiteInfo;
        return makeReq(delBlackWhiteInfo, params);
    }
}